package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserMapper {
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user values (null,#{openid},#{name},#{phone},#{sex},#{idNumber},#{avatar},#{createTime})")
    void insertUser(User user);

    @Select("select * from user where openid=#{openid}")
    User selectUser(String openid);
    @Select("select * from user where id=#{userId}")
    User selectUserById(Long userId);

   Integer countUserStatistics(LocalDateTime begin, LocalDateTime end);
}
